<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>

    <script>
        // let str = '张三：2500，李四：3000，王五：4600'
        // let reg = /\d{4,}/g


        // console.log(reg.test(str), reg.lastIndex)
        // console.log(reg.test(str), reg.lastIndex)
        // console.log(reg.test(str), reg.lastIndex)
        // console.log(reg.test(str), reg.lastIndex)

        // let str = '2015-1-09'
        // let reg = /(\d{4})-(\d{1,2})-(\d{1,2})/

        // let str = '  1234 sdfsda dsfas dfasdf asd'


        // console.log(str.split(' '))
        // console.log(str.split(' ').join(''))

        // var pattern = /8[a-zA-Z0-9]*7/  // 贪婪
        var pattern = /8[a-zA-Z0-9]+7/  // 贪婪
        var string = "abc8d7klngon8qrstwxy7"

        console.log(pattern.exec(string))


    </script>

</body>

</html>